package com.lijj.flower.util;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtils {
    /**
     * 获取当今年份第一天
     * */
    public static String getFirstDayByYear() {
        Date now = new Date();
        Calendar c = Calendar.getInstance();
        c.setTime(now);

        c.set(Calendar.DAY_OF_YEAR, 1);
        DateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");
        format.format(c.getTime());
        System.out.println(format.format(c.getTime())+" 00:00:00"); // 第一天
        return null;
    }

    public static void main(String[] args) {
        DateUtils.getFirstDayByYear();
    }
}
